2300 # Context switch
2301 #
2302 #   void swtch(struct context **old, struct context *new);
2303 #
2304 # Save current register context in old
2305 # and then load register context from new.
2306 
2307 .globl swtch
2308 swtch:
2309   movl 4(%esp), %eax
2310   movl 8(%esp), %edx
2311 
2312   # Save old callee-save registers
2313   pushl %ebp
2314   pushl %ebx
2315   pushl %esi
2316   pushl %edi
2317 
2318   # Switch stacks
2319   movl %esp, (%eax)
2320   movl %edx, %esp
2321 
2322   # Load new callee-save registers
2323   popl %edi
2324   popl %esi
2325   popl %ebx
2326   popl %ebp
2327   ret
2328 
2329 
2330 
2331 
2332 
2333 
2334 
2335 
2336 
2337 
2338 
2339 
2340 
2341 
2342 
2343 
2344 
2345 
2346 
2347 
2348 
2349 
